package com.jacklin.utils;


import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * 将Object类型转换为Json格式输出
 *
 * @Author 林必昭
 * @Date 2019/4/19 14:50
 */
public class JsonUtil {

    public static String toJson(Object object){
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(object);

    }
}
